# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-stestr
pkgver=4.1.0
pkgrel=1
pkgdesc="A test runner runner similar to testrepository"
url="https://stestr.readthedocs.io/en/latest/"
license=('Apache')
arch=('any')
depends=('python-cliff' 'python-pbr' 'python-subunit' 'python-fixtures' 'python-testtools'
         'python-yaml' 'python-voluptuous' 'python-tomlkit' 'python-extras')
checkdepends=('python-hacking' 'python-sphinx' 'python-coverage'
              'python-ddt')
source=("https://pypi.io/packages/source/s/stestr/stestr-$pkgver.tar.gz")
sha512sums=('77287ffdfe59042c4d189aa6c662df4357633d3a134ea60a4533b5b8b1b433ffd6f265a430977da175f242cc1c8e8514f876a486cc900a436cf93ab629fe7b7d')

build() {
  cd stestr-$pkgver
  python setup.py build
}

check() {
  cd stestr-$pkgver
  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  (
    export PYTHONPATH="$PWD/tmp_install/usr/lib/python${python_version}/site-packages"
    export PATH="$PWD/tmp_install/usr/bin:$PATH"
    stestr run
  )
}

package() {
  cd stestr-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
}
